//
//  ByShopListProtuctCell.m
//  hutouben_ios
//
//  Created by pro on 16/11/29.
//  Copyright © 2016年 mc. All rights reserved.
//

#import "ByShopListProtuctCell.h"

@implementation ByShopListProtuctCell
{
    UIImageView *_mainView;     // 主图
    UILabel     *_titleLabel;   // 标题
    UILabel     *_descLabel;    // 描述
    UILabel     *_priceLabel;   // 价格
}

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    // 主图
    _mainView = [[UIImageView alloc] init];
    [self.contentView addSubview:_mainView];
    
    // 标题
    _titleLabel = [[UILabel alloc] init];
    _titleLabel.adjustsFontSizeToFitWidth = YES;
    _titleLabel.font = FONT(15);
    _titleLabel.textColor = TEXT_COLOR;
    _titleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_titleLabel];
    
    // 描述
    _descLabel = [[UILabel alloc] init];
    _descLabel.numberOfLines = 2;
    _descLabel.font = FONT(12);
    _descLabel.textColor = [UIColor lightGrayColor];
    _descLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_descLabel];
    
    // 价格
    _priceLabel = [[UILabel alloc] init];
    _priceLabel.adjustsFontSizeToFitWidth = YES;
    _priceLabel.font = FONT(18);
    _priceLabel.textColor = HTB_THEME_COLOR;
    _priceLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_priceLabel];
}


- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    _mainView.frame     = CGRectMake(0, 0, self.width, self.width);
    _titleLabel.frame   = CGRectMake(5, _mainView.bottom, self.width - 10, 25);
    _descLabel.frame    = CGRectMake(5, _titleLabel.bottom, self.width - 10, 30);
    _priceLabel.frame   = CGRectMake(5, _descLabel.bottom, self.width - 10, 30);
    
    _mainView.backgroundColor = [UIColor orangeColor];
    _titleLabel.text    = @"商品标题";
    _descLabel.text     = @"商品描述自适应2行，商品描述自适应2行，商品描述自适应2行，商品描述自适应2行，商品描述自适应2行，";
    _priceLabel.text    = @"￥100";
}
@end
